package my.graduation.controller.common;

import my.graduation.dto.DataDto;
import my.graduation.dto.RegRecordDto;
import my.graduation.entity.RegistrationRecord;
import my.graduation.result.Result;
import my.graduation.service.RegistrationRecordService;
import my.graduation.vo.AlertPaidVO;
import my.graduation.vo.DataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: RavenLyn
 * @Date: 2024-12-20
 */
@RestController
@RequestMapping
public class RegisterRecordController {

    @Autowired
    private RegistrationRecordService registrationRecordService;

    /**
     * 获取当前的挂号记录
     * @param dto
     * @return
     */
    @PostMapping("/patient/reg_record")
    public Result<RegistrationRecord> getRegCurrentRecord (@RequestBody RegRecordDto dto){
        return registrationRecordService.getRegCurrentRecord(dto);
    }

    /**
     * 获取该patientId下的所有挂号记录
     * @param dto
     * @return
     */
    @PostMapping("/patient/reg_record/list")
    public Result<List<RegistrationRecord>> getListByPatientId (@RequestBody RegRecordDto dto){
        return registrationRecordService.getListByPatientId(dto);
    }

//    /**
//     * 获取该patientId获取最近的挂号状态 -日期最大，且待就诊
//     * 主要返回clinicName
//     * @param dto
//     * @return
//     */
//    @PostMapping("/patient/reg_record/recent")
//    public Result<Clinic> getRegStatusByPatientId (@RequestBody RegRecordDto dto){
//        return registrationRecordService.getRegStatusByPatientId(dto);
//    }


//    /**
//     * 医生获取当天挂号队列
//     * @param dto
//     * @return
//     */
//    @PostMapping("/doctor/reg_record")
//    public Result<List<RegistrationRecordVO>> getListByDoctorId(@RequestBody RegRecordDto dto){
//        return registrationRecordService.getListByDoctorId(dto);
//    }

    /**
     * 医生修改患者挂号状态-完成
     * @param dto
     * @return
     */
    @PutMapping("/doctor/reg_record")
    public Result inquiryFinished(@RequestBody RegRecordDto dto){
        return registrationRecordService.inquiryFinished(dto);
    }

    /**
     * 管理员获取挂号数据 - 数据分析
     * @param dto
     * @return
     */
    @PostMapping("/admin/reg_data")
    public Result<List<DataVO>> getRegData(@RequestBody DataDto dto){
        return registrationRecordService.getRegData(dto);
    }

    /**
     * 管理员获取未就诊挂号记录
     * @return
     */
    @GetMapping("/admin/reg_paid")
    public Result<List<AlertPaidVO>> getPaidData(){
        return registrationRecordService.getPaidData();
    }
}
